﻿using System;
using System.Collections.Generic;
using System.Net.WebSockets;
using System.Text;
using System.Threading.Tasks;
using WebSocketCore.Domain.Account;
using WebSocketCore.Domain.Entities;

namespace WebSocketCore.Domain
{
    public interface IChatRoomManager
    {
        void AddRoom(ChatRoomEntity chatRoomEntity);
        IEnumerable<Tuple<string, string>> GetRooms();
        Task AddUserToRoom(string roomId,IUser user,WebSocket webSocket);
        Task RemoveUserFromRoom(ChatRoomEntity room, IUser user, WebSocket webSocket,bool dispose);
        /// <summary>
        /// 0：不在房间 1：切换房间 2:已经在此房间
        /// </summary>
        /// <param name="roomId"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        //int CheckUserInRoom(string roomId,IUser user);
        string GetRoomName(string id);
        ChatRoomEntity GetUserRoom(IUser user);
        bool HasRoom(string roomId);
        /// <summary>
        /// 全员通知
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        Task NotifyAllAsync(MessageEntity msg);
        Task NotifyRoomAsync(string roomId, MessageEntity msg);
    }
}
